<%@ page import="java.util.List" %>
<%@ page import="com.foreknow.model.Gusetbook" %>
<%
    String path = request.getContextPath();
%>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/2/27
  Time: 9:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/bootstrap.min.css">
</head>
<body>

        username:${username}
    <table style="border: solid 2px
     chartreuse" class="table table-hover">
        <tr>
            <td>id</td>
            <td>name</td>
            <td>phone</td>
            <td>email</td>
            <td>title</td>
            <td>content</td>
            <td>createdtime</td>
            <td>操作</td>
        </tr>
        <%-- 如何才能获取到保存在服务器端的list集合--%>
        <%
            //request.getAttribute("list");获取保存在服务器端的数据
            //request.getAttribute("list");可以根据key值就可以获取到对应的value
            List<Object > list = (List<Object>) request.getAttribute("list");
            for (int i=0;i<list.size();i++){
                Gusetbook gb= (Gusetbook) list.get(i);
        %>   <tr>
            <td><%=gb.getId()%></td>
            <td><%=gb.getName()%></td>
            <td><%=gb.getPhone()%></td>
            <td><%=gb.getEmail()%></td>
            <td><%=gb.getTitle()%></td>
            <td><%=gb.getContent()%></td>
            <td><%=gb.getCreatedtime()%></td>
            <td>
                <a href="<%=path%>/manager?id=<%=gb.getId()%>&q=getById" class="btn btn-primary">修改</a>
                <a href="<%=path%>/manager?id=<%=gb.getId()%>&q=delete" class="btn btn-danger">删除</a>

            </td>
        </tr>
        <%
            }


        %>

    </table>

</body>
</html>
